package com.bootdo.program.weixin.controller;

import java.util.List;
import java.util.Map;

import com.bootdo.common.controller.BaseController;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.bootdo.program.weixin.domain.WxUserDO;
import com.bootdo.program.weixin.service.WxUserService;
import com.bootdo.common.utils.PageUtils;
import com.bootdo.common.utils.Query;
import com.bootdo.common.utils.R;

/**
 * 小程序用户表
 * 
 * @author guoyunfei
 * @email 2549789059@qq.com
 * @date 2021-07-22 20:22:41
 */
 
@Controller
@RequestMapping("/weixin/wxUser")
public class WxUserController extends BaseController {
	@Autowired
	private WxUserService wxUserService;
	
	@GetMapping()
	@RequiresPermissions("weixin:wxUser:wxUser")
	String WxUser(){
	    return "weixin/wxUser/wxUser";
	}
	
	@ResponseBody
	@GetMapping("/list")
	@RequiresPermissions("weixin:wxUser:wxUser")
	public PageUtils list(@RequestParam Map<String, Object> params){
		params.put("appid",isAdmin() ? null : (null == defaultAppid() ? "noData" : defaultAppid()));
		//查询列表数据
        Query query = new Query(params);
		List<WxUserDO> wxUserList = wxUserService.list(query);
		int total = wxUserService.count(query);
		PageUtils pageUtils = new PageUtils(wxUserList, total);
		return pageUtils;
	}
	
	
	
}
